<?php

/**
 * @name: HOTN AnimeList
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnanimelist/
 */

// Admin oldal címének meghatározása
$title .= " \ ".HOTN_ANIMELIST_ADMIN_MENU_TEAM_EDIT;

if ($qs[2]=="action" && $qs[3]<>"")
{
	// adatok lekérése
	$sql->db_Select("hotn_animelist_team, ".MPREFIX."user","*"," user_id = team_id and user_id = '".((int)$qs[3])."'");
	$row = $sql->db_Fetch();
	
	$values['team_user'] = array($row['user_id'] => $row['user_loginname']);
	$values['team_id'] = $row['user_id'];
	$values['team_do'] = $row['team_do'];
	$values['team_email'] = $row['user_email'];
	
	$values['action'] = array("action"=>"edit","user_id"=>$row['user_id']);
	$values["team_submit"] = HOTN_ANIMELIST_ADMIN_TEAM_FORUM_SAVE;
	$values['form_action'] = e_PLUGIN."hotn_animelist/Admin/team/admin_team_action.php";
	
	// tömb külön file-ban
	include(e_PLUGIN."hotn_animelist/Admin/team/array.php");

	$text = $HOTN_ANIMELIST_FORM->show_form($data);
}
else
{
	// csapattagok kiírása
	if ( $sql->db_Select("hotn_animelist_team, ".MPREFIX."user","*"," user_id = team_id ORDER BY user_name ASC") <> 0 )
	{
		$text = "
		<form action='".e_PLUGIN."hotn_animelist/Admin/team/admin_team_action.php' method='post'>
		<input type='hidden' name='action' value='delete' />
			<table class='fborder'>
				<tr>
					<td class='fcaption'>
						".HOTN_ANIMELIST_ADMIN_TEAM_TABLE_NAME."
					</td>
					<td class='fcaption'>
						".HOTN_ANIMELIST_ADMIN_TEAM_TABLE_EMAIL."
					</td>
					<td class='fcaption'>
						".HOTN_ANIMELIST_ADMIN_TEAM_TABLE_OPTIONS."
					</td>
				</tr>
		";
		
		while($row = $sql->db_Fetch())
		{
			$text .= "
				<tr>
					<td class='forumheader3'>
						<a href='".e_PLUGIN."hotn_animelist/Admin/admin_index.php?team.edit.action.".$row['team_id']."'>".$row['user_name']."</a>
					</td>
					<td class='forumheader3' style='text-align:center'>
						".$row['team_email']."
					</td>
					<td class='forumheader3' style='text-align:center'>
						<input type='checkbox' class='tbox' name='team_id[]' value='".$row['user_id']."'>
					</td>
				</tr>
			";
		}
		
		$text .= "
				<tr>
					<td colspan='3' class='forumheader' style='text-align:center;'>
						<input type='submit' class='button' value='".HOTN_ANIMELIST_ADMIN_TEAM_FORM_SUBMIT."'>
					</td>
				</tr>
			</table>
		</form>";
	}
	else
	{
		// Nincs csapattag üzenet
		$text = HOTN_ANIMELIST_ADMIN_TEAM_NO_ITTEM;
	}
}



// Admin oldal tartalmának megjelenítése
$text = "<div style='text-align: center;'>".$text."</div>";
?>